package com.simple.indiapay.controller;

import com.simple.common.entity.ResData;
import com.simple.common.entity.controller.IndiaWithdrawal;
import com.simple.common.entity.dto.pay.india.IndiaWithdrawalDto;
import com.simple.common.entity.dto.pay.india.IndiaWithdrawalQueryDto;
import com.simple.common.entity.dto.pay.india.IndiaWithdrawalQueryRspDto;
import com.simple.common.entity.dto.pay.india.IndiaWithdrawalRspDto;
import com.simple.indiapay.service.TransferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author yasud
 * @date 2021年11月06日 17:30
 * @description
 */
@RestController
public class TransferController implements IndiaWithdrawal {

    @Autowired
    TransferService transferService;

    @Override
    public ResData withdrawal(IndiaWithdrawalDto dto) throws Exception {
        IndiaWithdrawalRspDto rspDto = transferService.transfer(dto);
        return ResData.ok(rspDto);
    }

    @Override
    public ResData withdrawalQuery(IndiaWithdrawalQueryDto dto) throws IOException {
        IndiaWithdrawalQueryRspDto rspDto = transferService.query(dto);
        return ResData.ok(rspDto);
    }
}
